package com.thread.resource.sharing.danger;

public abstract class IntGenerator {

	// canceled因为是Boolean类型，所以它是原子性的
	private volatile boolean canceled = false;

	public abstract int next();

	public void cancel() {
		canceled = true;
	}

	public boolean isCancel() {
		return canceled;
	}

}
